package com.ruoyi.lvlian.service.impl;

import java.util.List;

import com.ruoyi.lvlian.dto.Lv91CollectInfoBatchDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.lvlian.mapper.Lv91CollectInfoMapper;
import com.ruoyi.lvlian.domain.Lv91CollectInfo;
import com.ruoyi.lvlian.service.ILv91CollectInfoService;

/**
 * 浙江91入库单Service业务层处理
 *
 * @author liyuxi
 * @date 2024-06-03
 */
@Service
public class Lv91CollectInfoServiceImpl implements ILv91CollectInfoService {
    @Autowired
    private Lv91CollectInfoMapper lv91CollectInfoMapper;

    /**
     * 查询浙江91入库单
     *
     * @param collectId 浙江91入库单主键
     * @return 浙江91入库单
     */
    @Override
    public Lv91CollectInfo selectLv91CollectInfoByCollectId(String collectId) {
        return lv91CollectInfoMapper.selectLv91CollectInfoByCollectId(collectId);
    }

    /**
     * 查询浙江91入库单列表
     *
     * @param lv91CollectInfo 浙江91入库单
     * @return 浙江91入库单
     */
    @Override
    public List<Lv91CollectInfo> selectLv91CollectInfoList(Lv91CollectInfo lv91CollectInfo) {
        return lv91CollectInfoMapper.selectLv91CollectInfoList(lv91CollectInfo);
    }

    /**
     * 新增浙江91入库单
     *
     * @param lv91CollectInfo 浙江91入库单
     * @return 结果
     */
    @Override
    public int insertLv91CollectInfo(Lv91CollectInfo lv91CollectInfo) {
        return lv91CollectInfoMapper.insertLv91CollectInfo(lv91CollectInfo);
    }

    /**
     * 修改浙江91入库单
     *
     * @param lv91CollectInfo 浙江91入库单
     * @return 结果
     */
    @Override
    public int updateLv91CollectInfo(Lv91CollectInfo lv91CollectInfo) {
        return lv91CollectInfoMapper.updateLv91CollectInfo(lv91CollectInfo);
    }

    /**
     * 批量删除浙江91入库单
     *
     * @param collectIds 需要删除的浙江91入库单主键
     * @return 结果
     */
    @Override
    public int deleteLv91CollectInfoByCollectIds(String[] collectIds) {
        return lv91CollectInfoMapper.deleteLv91CollectInfoByCollectIds(collectIds);
    }

    /**
     * 删除浙江91入库单信息
     *
     * @param collectId 浙江91入库单主键
     * @return 结果
     */
    @Override
    public int deleteLv91CollectInfoByCollectId(String collectId) {
        return lv91CollectInfoMapper.deleteLv91CollectInfoByCollectId(collectId);
    }

    @Override
    public int insertLv91CollectInfoBatch(  Lv91CollectInfoBatchDto lv91CollectInfoBatchDTO ) {
        List<Lv91CollectInfo> lv91CollectInfoList = lv91CollectInfoBatchDTO.getDatas();
        for(Lv91CollectInfo  po:lv91CollectInfoList){
            po.setGroupId(lv91CollectInfoBatchDTO.getGroupId());
            po.setSendSerialNum(lv91CollectInfoBatchDTO.getSendSerialNum());
        }
        return lv91CollectInfoMapper.insertLv91CollectInfoBatch(lv91CollectInfoList);
    }
}
